import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('gameState')
export class gameState {
    public static sound_state: boolean = false;
    public static game_model: number = 0;//游戏0  编辑1
    public static edit_model: number = 1;//add block 1 /del block 2/add grid 3/del grid 4
    public static cur_lvl: number = 1;
    public static lvl_config = [
        { "lvl": 1, "types": 4, list: [{ "x": -116, "y": 160 }, { "x": -116, "y": 120 }, { "x": -116, "y": 160 }, { "x": -1, "y": 160 }, { "x": -1, "y": 120 }, { "x": -1, "y": 160 }, { "x": 115, "y": 160 }, { "x": 115, "y": 120 }, { "x": 115, "y": 160 }, { "x": -116, "y": 0 }, { "x": -116, "y": -40 }, { "x": -116, "y": 0 }, { "x": -1, "y": 0 }, { "x": -1, "y": -40 }, { "x": -1, "y": 0 }, { "x": 115, "y": 0 }, { "x": 115, "y": -40 }, { "x": 115, "y": 0 }, { "x": -116, "y": -160 }, { "x": -116, "y": -200 }, { "x": -116, "y": -160 }, { "x": -1, "y": -160 }, { "x": -1, "y": -200 }, { "x": -1, "y": -160 }, { "x": 115, "y": -160 }, { "x": 115, "y": -200 }, { "x": 115, "y": -160 }] }
        , { "lvl": 2, "types": 5, list: [{ "x": -155, "y": 280 }, { "x": -116, "y": 280 }, { "x": -78, "y": 280 }, { "x": -39, "y": 280 }, { "x": -1, "y": 280 }, { "x": 38, "y": 280 }, { "x": 76, "y": 280 }, { "x": 115, "y": 280 }, { "x": 153, "y": 280 }, { "x": 192, "y": 280 }, { "x": -193, "y": 280 }, { "x": -193, "y": 200 }, { "x": -155, "y": 200 }, { "x": -116, "y": 200 }, { "x": -78, "y": 200 }, { "x": -39, "y": 200 }, { "x": -1, "y": 200 }, { "x": 38, "y": 200 }, { "x": 76, "y": 200 }, { "x": 115, "y": 200 }, { "x": 153, "y": 200 }, { "x": 192, "y": 200 }, { "x": -232, "y": 120 }, { "x": -193, "y": 120 }, { "x": 230, "y": 120 }, { "x": 192, "y": 120 }, { "x": 153, "y": 120 }, { "x": 115, "y": 120 }, { "x": 76, "y": 120 }, { "x": 38, "y": 120 }, { "x": -1, "y": 120 }, { "x": -39, "y": 120 }, { "x": -78, "y": 120 }, { "x": -116, "y": 120 }, { "x": -155, "y": 120 }, { "x": -193, "y": 120 }, { "x": -232, "y": 120 }, { "x": -155, "y": 240 }, { "x": -116, "y": 240 }, { "x": -78, "y": 240 }, { "x": -39, "y": 240 }, { "x": -1, "y": 240 }, { "x": 38, "y": 240 }, { "x": 76, "y": 240 }, { "x": 115, "y": 240 }, { "x": 38, "y": 240 }, { "x": -39, "y": 240 }, { "x": -116, "y": 240 }, { "x": -217, "y": -22 }, { "x": -217, "y": -40 }, { "x": -214, "y": -54 }, { "x": -211, "y": -69 }, { "x": -211, "y": -86 }, { "x": -214, "y": -92 }, { "x": -211, "y": -103 }, { "x": -214, "y": -121 }, { "x": -211, "y": -127 }, { "x": -214, "y": -155 }, { "x": -214, "y": -167 }, { "x": -214, "y": -182 }, { "x": -214, "y": -213 }, { "x": -217, "y": -222 }, { "x": -217, "y": -234 }, { "x": 215, "y": -40 }, { "x": 215, "y": -92 }, { "x": 215, "y": -95 }, { "x": 209, "y": -208 }, { "x": 209, "y": -196 }, { "x": 209, "y": -179 }, { "x": 209, "y": -147 }, { "x": 209, "y": -127 }, { "x": 215, "y": -40 }, { "x": 215, "y": -34 }, { "x": -156, "y": -277 }, { "x": -101, "y": -277 }, { "x": -52, "y": -277 }, { "x": -40, "y": -277 }, { "x": -20, "y": -277 }, { "x": 166, "y": -283 }, { "x": 215, "y": -57 }, { "x": 215, "y": -69 }, { "x": 215, "y": -92 }, { "x": 212, "y": -106 }, { "x": 209, "y": -127 }, { "x": 209, "y": -147 }, { "x": 209, "y": -196 }, { "x": 206, "y": -225 }, { "x": 212, "y": -239 }, { "x": -155, "y": 40 }, { "x": -116, "y": 40 }, { "x": -78, "y": 40 }, { "x": -39, "y": 40 }, { "x": -1, "y": 40 }, { "x": 38, "y": 40 }, { "x": 76, "y": 40 }, { "x": 115, "y": 40 }, { "x": 153, "y": 40 }, { "x": 192, "y": 40 }, { "x": -116, "y": -80 }, { "x": -78, "y": -80 }, { "x": -39, "y": -80 }, { "x": -1, "y": -80 }, { "x": 38, "y": -80 }, { "x": 76, "y": -80 }, { "x": 115, "y": -80 }, { "x": 115, "y": -160 }, { "x": 76, "y": -160 }, { "x": 38, "y": -160 }, { "x": -1, "y": -160 }, { "x": -39, "y": -160 }, { "x": -78, "y": -160 }, { "x": -116, "y": -160 }, { "x": -78, "y": -120 }, { "x": -39, "y": -120 }, { "x": -1, "y": -120 }, { "x": 38, "y": -120 }, { "x": 76, "y": -120 }, { "x": -1, "y": -120 }, { "x": -78, "y": -120 }, { "x": -193, "y": 280 }, { "x": -193, "y": 200 }, { "x": -116, "y": 80 }, { "x": -39, "y": 80 }, { "x": 38, "y": 80 }, { "x": 115, "y": 80 }, { "x": 230, "y": 120 }, { "x": -232, "y": 40 }, { "x": 230, "y": 40 }, { "x": -193, "y": 40 }, { "x": -232, "y": 40 }, { "x": 218, "y": -69 }, { "x": -208, "y": -57 }, { "x": -78, "y": -40 }, { "x": -1, "y": -40 }, { "x": 76, "y": -40 }, { "x": -20, "y": -277 }, { "x": 116, "y": -283 }, { "x": 102, "y": -283 }, { "x": 90, "y": -283 }, { "x": 35, "y": -277 }, { "x": -52, "y": -277 }] }
    ]
    public static ad_free_times: number = 0;
    public static ad_redo_times: number = 0;
    public static ad_remove_times: number = 0;
    public static ad_random_times: number = 0;
    public static get_data_by_lvl(lvl: number): any {
        const element = this.lvl_config.find(element => element.lvl === lvl);
        return element || null;
    }
    public static get_max_lvl(): number {
        let lvl: number = 0;
        this.lvl_config.forEach(element => {
            if (element.lvl > lvl) lvl = element.lvl;
        });
        return lvl;
    }
    public static reset_ad_times() {
        gameState.ad_free_times = 1;
        gameState.ad_redo_times = 1;
        gameState.ad_remove_times = 1;
        gameState.ad_random_times = 1;
    }
}
